#pragma once
#include "Utility.h"

#include "UIlib.h"
using namespace DuiLib;

#define BEGIN_DUINOTIFY_MAP()										\
	void Notify(TNotifyUI& msg){									\

#define BEGIN_DUINOTIFY_MAPEX(baseClass)							\
	void Notify(TNotifyUI& msg){									\
		baseClass::Notify(msg);										\

#define ON_DUINOTIFY_TYPE(typeName, funcName)						\
		if(msg.sType == _T(typeName))								\
		{															\
			funcName(msg);											\
		}

#define ON_DUINOTIFY_CONTROL(typeName, ctrlName, funcName)			\
		if(msg.pSender && msg.sType == _T(typeName) &&				\
			msg.pSender->GetName() == _T(ctrlName))					\
		{															\
			funcName(msg);											\
		}

#define ON_DUINOTIFY_MESSAGE(typeName, msgName, funcName)			\
		if(msg.sType == _T(typeName) &&								\
			msg.sMessage == _T(msgName))							\
		{															\
			funcName(msg);											\
		}

#define ON_DUINOTIFY_POINTER(typeName, ctrlPointer, funcName)		\
		if(msg.sType == _T(typeName) && msg.pSender == ctrlPointer)	\
		{															\
			funcName(msg);											\
		}

#define END_DUINOTIFY_MAP()											\
	}

#define END_DUINOTIFY_MAPEX END_DUINOTIFY_MAP


#define EXCEL_FILE_FILTER		_T("Excel Files\0*.xls\0All Files\0*.*\0\0")

BOOL BrowseFile(HWND hParent, LPCTSTR szFilter, LPCTSTR szTitle, CStdString& strFile);

class CMainWnd;

CMainWnd* GetMainWnd();